package com.atech.ebayadmin.merchandise.model;

import java.io.File;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.atech.ebayadmin.amount.model.Amount;
import com.ebay.soap.eBLBaseComponents.CurrencyCodeType;
import com.ebay.soap.eBLBaseComponents.SiteCodeType;

public class Merchandise implements java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1783284267848731941L;
	private Integer id;//主键
    private String title;//商品名称
    
    private String subTitle;//子名称
    private Integer startPriceAmountId;
    private Amount startPrice = new Amount();//金额
    private Integer quantity = new Integer(1);//库存
    private String categoryID = "0";//分类ID
    private String description;//商品描述
    private String site;
    private String ebayAccount;//使用的ebay帐号
	private String listingType;
	private String ebayID;//上传到ebay后返回的商品ID
	private Integer lotSize = new Integer(1);
	private Double reservedPrice = null;
	private String payPalEmailAddress = "abc@tom.com";
	private String[] pictureFiles;
	private Boolean autoPay = false;
	private Boolean bestOfferDetail = false;
	private String location = "";
	private String[] paymentArray;
	private String paymentMethodList;
	private Integer userId;
	private File picFile1;
	private String picFile1FileName;
	private String picFile1ContentType;
	private File picFile2;
	private String picFile2FileName;
	private String picFile2ContentType;
	private File picFile3;
	private String picFile3FileName;
	private String picFile3ContentType;
	private String priority;
	private Amount additionalCost = new Amount();
	private Amount cost = new Amount();
	private Integer costAmountID;
	private Integer additionalCostAmountID;
	private String shippingService;
    private Integer uploadCount;//上传的次数
    private Integer uploadPerTime;//间隔时间，以分钟为单位
    private Integer hadUploadCount;//已经上传的次数
    private Integer threadIsRunning;//线程是否在运行
    private Integer status = new Integer(0);//商品状态：0未上传，1 上传中
    private String dayListing;
    private List<PictureDetails> picList;
	public String getDayListing() {
		return dayListing;
	}
	public void setDayListing(String dayListing) {
		this.dayListing = dayListing;
	}
	/**
	 * @return the serialVersionUID
	 */
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
	/**
	 * @return the autoPay
	 */
	public Boolean getAutoPay() {
		return autoPay;
	}
	/**
	 * @param autoPay the autoPay to set
	 */
	public void setAutoPay(Boolean autoPay) {
		this.autoPay = autoPay;
	}
	/**
	 * @return the bestOfferDetail
	 */
	public Boolean getBestOfferDetail() {
		return bestOfferDetail;
	}
	/**
	 * @param bestOfferDetail the bestOfferDetail to set
	 */
	public void setBestOfferDetail(Boolean bestOfferDetail) {
		this.bestOfferDetail = bestOfferDetail;
	}
	/**
	 * @return the categoryID
	 */
	public String getCategoryID() {
		return categoryID;
	}
	/**
	 * @param categoryID the categoryID to set
	 */
	public void setCategoryID(String categoryID) {
		this.categoryID = categoryID;
	}
	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	/**
	 * @return the ebayAccount
	 */
	public String getEbayAccount() {
		return ebayAccount;
	}
	/**
	 * @param ebayAccount the ebayAccount to set
	 */
	public void setEbayAccount(String ebayAccount) {
		this.ebayAccount = ebayAccount;
	}
	/**
	 * @return the ebayID
	 */
	public String getEbayID() {
		return ebayID;
	}
	/**
	 * @param ebayID the ebayID to set
	 */
	public void setEbayID(String ebayID) {
		this.ebayID = ebayID;
	}
	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}
	/**
	 * @return the listingType
	 */
	public String getListingType() {
		return listingType;
	}
	/**
	 * @param listingType the listingType to set
	 */
	public void setListingType(String listingType) {
		this.listingType = listingType;
	}
	/**
	 * @return the location
	 */
	public String getLocation() {
		return location;
	}
	/**
	 * @param location the location to set
	 */
	public void setLocation(String location) {
		this.location = location;
	}
	/**
	 * @return the lotSize
	 */
	public Integer getLotSize() {
		return lotSize;
	}
	/**
	 * @param lotSize the lotSize to set
	 */
	public void setLotSize(Integer lotSize) {
		this.lotSize = lotSize;
	}
	/**
	 * @return the paymentMethodList
	 */
	public String getPaymentMethodList() {
		return paymentMethodList;
	}
	/**
	 * @param paymentMethodList the paymentMethodList to set
	 */
	public void setPaymentMethodList(String paymentMethodList) {
		this.paymentMethodList = paymentMethodList;
	}
	/**
	 * @return the payPalEmailAddress
	 */
	public String getPayPalEmailAddress() {
		return payPalEmailAddress;
	}
	/**
	 * @param payPalEmailAddress the payPalEmailAddress to set
	 */
	public void setPayPalEmailAddress(String payPalEmailAddress) {
		this.payPalEmailAddress = payPalEmailAddress;
	}
	/**
	 * @return the pictureFiles
	 */
	public String[] getPictureFiles() {
		return pictureFiles;
	}
	/**
	 * @param pictureFiles the pictureFiles to set
	 */
	public void setPictureFiles(String[] pictureFiles) {
		this.pictureFiles = pictureFiles;
	}
	/**
	 * @return the quantity
	 */
	public Integer getQuantity() {
		return quantity;
	}
	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	/**
	 * @return the reservedPrice
	 */
	public Double getReservedPrice() {
		return reservedPrice;
	}
	/**
	 * @param reservedPrice the reservedPrice to set
	 */
	public void setReservedPrice(Double reservedPrice) {
		this.reservedPrice = reservedPrice;
	}
	/**
	 * @return the site
	 */
	public String getSite() {
		return site;
	}
	/**
	 * @param site the site to set
	 */
	public void setSite(String site) {
		this.site = site;
	}
	/**
	 * @return the startPrice
	 */
	public Amount getStartPrice()throws Exception{
        if (this.getSite().equals("US")) {
        	startPrice.setCurrencyID(CurrencyCodeType.USD.toString());
        }else if (this.getSite().equals("France") || this.getSite().equals("Germany")){
        	startPrice.setCurrencyID(CurrencyCodeType.EUR.toString());
        }else if (this.getSite().equals("Australia") ){
        	startPrice.setCurrencyID(CurrencyCodeType.AUD.toString());
        }else if (this.getSite().equals("UK")){
        	startPrice.setCurrencyID(CurrencyCodeType.GBP.toString());
        }else{
        	throw new Exception("could not support this site");
        }
		if(StringUtils.isNotBlank(startPrice.getValueString())){
			startPrice.setValue(Double.parseDouble(startPrice.getValueString()));
		}
		return startPrice;
	}
	/**
	 * 老板常用US/UK/FR/AU/DE
		所以先做
		US: USD
		UK: GBP
		FR/DE: EUR
		AU: AUD
	 * @param startPrice the startPrice to set
	 */
	public void setStartPrice(Amount startPrice) {
		this.startPrice = startPrice;
	}
	/**
	 * @return the startPriceAmountId
	 */
	public Integer getStartPriceAmountId() {
		return startPriceAmountId;
	}
	/**
	 * @param startPriceAmountId the startPriceAmountId to set
	 */
	public void setStartPriceAmountId(Integer startPriceAmountId) {
		this.startPriceAmountId = startPriceAmountId;
	}
	/**
	 * @return the subTitle
	 */
	public String getSubTitle() {
		return subTitle;
	}
	/**
	 * @param subTitle the subTitle to set
	 */
	public void setSubTitle(String subTitle) {
		this.subTitle = subTitle;
	}
	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}
	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	/**
	 * @return the additionalCost
	 */
	public Amount getAdditionalCost()throws Exception{
        if (this.getSite().equals("US")) {
        	additionalCost.setCurrencyID(CurrencyCodeType.USD.toString());
        }else if (this.getSite().equals("France") || this.getSite().equals("Germany")){
        	additionalCost.setCurrencyID(CurrencyCodeType.EUR.toString());
        }else if (this.getSite().equals("Australia") ){
        	additionalCost.setCurrencyID(CurrencyCodeType.AUD.toString());
        }else if (this.getSite().equals("UK")){
        	additionalCost.setCurrencyID(CurrencyCodeType.GBP.toString());
        }else{
        	throw new Exception("could not support this site");
        }
		if(StringUtils.isNotBlank(additionalCost.getValueString())){
			additionalCost.setValue(Double.parseDouble(additionalCost.getValueString()));
		}
		return additionalCost;
	}
	/**
	 * @param additionalCost the additionalCost to set
	 */
	public void setAdditionalCost(Amount additionalCost) {
		this.additionalCost = additionalCost;
	}
	/**
	 * @return the cost
	 */
	public Amount getCost()throws Exception{
        if (this.getSite().equals("US")) {
        	cost.setCurrencyID(CurrencyCodeType.USD.toString());
        }else if (this.getSite().equals("France") || this.getSite().equals("Germany")){
        	cost.setCurrencyID(CurrencyCodeType.EUR.toString());
        }else if (this.getSite().equals("Australia") ){
        	cost.setCurrencyID(CurrencyCodeType.AUD.toString());
        }else if (this.getSite().equals("UK")){
        	cost.setCurrencyID(CurrencyCodeType.GBP.toString());
        }else{
        	throw new Exception("could not support this site");
        }
		if(StringUtils.isNotBlank(cost.getValueString())){
			cost.setValue(Double.parseDouble(cost.getValueString()));
		}
		return cost;
	}
	/**
	 * @param cost the cost to set
	 */
	public void setCost(Amount cost) {
		this.cost = cost;
	}
	/**
	 * @return the priority
	 */
	public String getPriority() {
		return priority;
	}
	/**
	 * @param priority the priority to set
	 */
	public void setPriority(String priority) {
		this.priority = priority;
	}
	/**
	 * @return the shippingService
	 */
	public String getShippingService() {
		return shippingService;
	}
	/**
	 * @param shippingService the shippingService to set
	 */
	public void setShippingService(String shippingService) {
		this.shippingService = shippingService;
	}
	/**
	 * @return the status
	 */
	public Integer getStatus() {
		return status;
	}
	/**
	 * @param status the status to set
	 */
	public void setStatus(Integer status) {
		this.status = status;
	}
	/**
	 * @return the uploadCount
	 */
	public Integer getUploadCount() {
		return uploadCount;
	}
	/**
	 * @param uploadCount the uploadCount to set
	 */
	public void setUploadCount(Integer uploadCount) {
		this.uploadCount = uploadCount;
	}
	/**
	 * @return the uploadPerTime
	 */
	public Integer getUploadPerTime() {
		return uploadPerTime;
	}
	/**
	 * @param uploadPerTime the uploadPerTime to set
	 */
	public void setUploadPerTime(Integer uploadPerTime) {
		this.uploadPerTime = uploadPerTime;
	}
	/**
	 * @return the additionalCostAmountID
	 */
	public Integer getAdditionalCostAmountID() {
		return additionalCostAmountID;
	}
	/**
	 * @param additionalCostAmountID the additionalCostAmountID to set
	 */
	public void setAdditionalCostAmountID(Integer additionalCostAmountID) {
		this.additionalCostAmountID = additionalCostAmountID;
	}
	/**
	 * @return the costAmountID
	 */
	public Integer getCostAmountID() {
		return costAmountID;
	}
	/**
	 * @param costAmountID the costAmountID to set
	 */
	public void setCostAmountID(Integer costAmountID) {
		this.costAmountID = costAmountID;
	}
	public File getPicFile1() {
		return picFile1;
	}
	public void setPicFile1(File picFile1) {
		this.picFile1 = picFile1;
	}
	public File getPicFile2() {
		return picFile2;
	}
	public void setPicFile2(File picFile2) {
		this.picFile2 = picFile2;
	}
	public File getPicFile3() {
		return picFile3;
	}
	public void setPicFile3(File picFile3) {
		this.picFile3 = picFile3;
	}
	public String getPicFile1ContentType() {
		return picFile1ContentType;
	}
	public void setPicFile1ContentType(String picFile1ContentType) {
		this.picFile1ContentType = picFile1ContentType;
	}
	public String getPicFile1FileName() {
		return picFile1FileName;
	}
	public void setPicFile1FileName(String picFile1FileName) {
		this.picFile1FileName = picFile1FileName;
	}
	public String getPicFile2ContentType() {
		return picFile2ContentType;
	}
	public void setPicFile2ContentType(String picFile2ContentType) {
		this.picFile2ContentType = picFile2ContentType;
	}
	public String getPicFile2FileName() {
		return picFile2FileName;
	}
	public void setPicFile2FileName(String picFile2FileName) {
		this.picFile2FileName = picFile2FileName;
	}
	public String getPicFile3ContentType() {
		return picFile3ContentType;
	}
	public void setPicFile3ContentType(String picFile3ContentType) {
		this.picFile3ContentType = picFile3ContentType;
	}
	public String getPicFile3FileName() {
		return picFile3FileName;
	}
	public void setPicFile3FileName(String picFile3FileName) {
		this.picFile3FileName = picFile3FileName;
	}
	public String[] getPaymentArray() {
		return paymentArray;
	}
	public void setPaymentArray(String[] paymentArray) {
		this.paymentArray = paymentArray;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	public List<PictureDetails> getPicList() {
		return picList;
	}
	public void setPicList(List<PictureDetails> picList) {
		this.picList = picList;
	}
	public Integer getHadUploadCount() {
		return hadUploadCount;
	}
	public void setHadUploadCount(Integer hadUploadCount) {
		this.hadUploadCount = hadUploadCount;
	}
	public Integer getThreadIsRunning() {
		return threadIsRunning;
	}
	public void setThreadIsRunning(Integer threadIsRunning) {
		this.threadIsRunning = threadIsRunning;
	}
}
